package com.crm.common.crm.entity.PO;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
 * <p>
 * 合同表
 * </p>
 *
 * @author zhangzhiwei
 * @since 2020-05-27
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("bill_crm_contract")
@ApiModel(value = "CrmContract对象", description = "合同表")
public class CrmContract implements Serializable {

    private static final long serialVersionUID = 1L;


    /** 机构名称 */
    private String orgName;

    private Integer studentId;

    @TableId(value = "contract_id", type = IdType.AUTO)
    private Integer contractId;

    @ApiModelProperty(value = "合同名称")
    private String name;

    /**
     * 合同名称
     */
    @TableField(exist = false)
    private String contractName;

    @ApiModelProperty(value = "客户ID")
    private Integer customerId;

    @TableField(exist = false)
    private String customerName;

    @ApiModelProperty(value = "商机ID")
    private Integer businessId;

    @ApiModelProperty(value = "0待审核、1通过、2拒绝、3审核中 4:撤回 5 未提交 6 创建 7 已删除 8 作废")
    private Integer checkStatus;

    @ApiModelProperty(value = "审核记录ID")
    private Integer examineRecordId;

    @ApiModelProperty(value = "下单日期")
    private Date orderDate;

    @ApiModelProperty(value = "创建人ID")
    @TableField(fill = FieldFill.INSERT)
    private Long createUserId;

    @ApiModelProperty(value = "负责人ID")
    private Long ownerUserId;

    @ApiModelProperty(value = "创建时间")
    @TableField(fill = FieldFill.INSERT)
    private Date createTime;

    @ApiModelProperty(value = "账单领取时间")
    @TableField(fill = FieldFill.INSERT)
    private Date billTime;

    @ApiModelProperty(value = "更新时间")
    @TableField(fill = FieldFill.UPDATE)
    private Date updateTime;

    @ApiModelProperty(value = "合同编号")
    private String num;

    @ApiModelProperty(value = "开始时间")
    private Date startTime;

    @ApiModelProperty(value = "结束时间")
    private Date endTime;

    @ApiModelProperty(value = "合同金额")
    private BigDecimal money;

    @ApiModelProperty(value = "整单折扣")
    private BigDecimal discountRate;

    @ApiModelProperty(value = "产品总金额")
    private BigDecimal totalPrice;

    @ApiModelProperty(value = "合同类型")
    private String types;

    @ApiModelProperty(value = "付款方式 定金 全款 账单")
    private String paymentType;

    @ApiModelProperty(value = "批次 比如附件批次")
    private String batchId;

    @ApiModelProperty(value = "只读权限")
    private String roUserId;

    @ApiModelProperty(value = "读写权限")
    private String rwUserId;

    @ApiModelProperty(value = "客户签约人（联系人id）")
    private Integer contactsId;

    @ApiModelProperty(value = "备注")
    private String remark;

    @ApiModelProperty(value = "公司签约人")
    private String companyUserId;


    @ApiModelProperty(value = "最后跟进时间")
    private Date lastTime;

    @ApiModelProperty(value = "已回款金额")
    private BigDecimal receivedMoney;

    @ApiModelProperty(value = "未回款金额")
    private BigDecimal unreceivedMoney;

    @ApiModelProperty(value = "货币名称")
    private String currencyName;

    @ApiModelProperty(value = "回款状态")
    private String backStatus;

    @ApiModelProperty(value = "应回款金额")
    private BigDecimal dueMonery;

    @ApiModelProperty(value = "最近回款时间")
    private Date recentBackTime;

    @ApiModelProperty(value = "退款金额")
    private BigDecimal refundMonery;

    @ApiModelProperty(value = "已开票金额")
    private BigDecimal invoicedMonery;


    @ApiModelProperty(value = "未开票金额")
    private BigDecimal uninvoicedMonery;

    @ApiModelProperty(value = "客户来源")
    private String source;

    @ApiModelProperty(value = "产品列表")
    @TableField(exist = false)
    private List<CrmContractProduct> list;

    @ApiModelProperty(value = "是否成交(未成交，已成交)")
    private String dealStatus;

    @ApiModelProperty(value = "购买课程")
    private String courseSource;

    @ApiModelProperty(value = "成交时间")
    private Date dealTime;

    @ApiModelProperty(value = "训练营期数")
    private String trainingPeriods;


    @ApiModelProperty(value = "是否重复")
    private String isRepetition;

    @ApiModelProperty(value = "营销讲师")
    private Long teacherId;


    @ApiModelProperty(value = "支付方式")
    private String returnType;

    @ApiModelProperty(value = "合同类型 合同类别1.三方账单2.人工创建")
    private String type;

    @ApiModelProperty(value = "所属账单池")
    private String ownerOrderPool;

    @ApiModelProperty(value = "学员姓名")
    private String studentName;

    @ApiModelProperty(value = "手机号")
    private String phone;


    @ApiModelProperty(value = "分期期数")
    private Integer periodsNum;
    @ApiModelProperty(value = "还款状态还款中 已还清 已逾期 已退学 已作废")
    private String repaymentStatus;

    @ApiModelProperty(value = "风险提示： 0 正常 1 高风险")
    private String riskLevel;

    @ApiModelProperty(value = "退学时间")
    private Date dropOutTime;
    @ApiModelProperty(value = "补款金额")
    private BigDecimal repairMoney;
    @ApiModelProperty(value = "付款时间")
    private Date paymentTime;
    @ApiModelProperty(value = "合同类型 首购 复购 转介绍")
    private String contractType;

    @ApiModelProperty(value = "账单支付方式：知好付")
    private String billReturnType;

    @ApiModelProperty(value = "已还期数")
    private Integer collectPeriods;

    @ApiModelProperty(value = "审核通过时间")
    private Date checkTime;

    /**
     * 有效，过期
     */
    private String orderPoolStatus;

    @ApiModelProperty(value = "过期时间")
    private Date expireTime;

    /**
     * 合同类别 账单合同,首付款合同,全款合同
     */
    @ApiModelProperty(value = "合同类别")
    private String contractCategory;

    @ApiModelProperty(value = "优惠金额")
    private BigDecimal preferentialMoney;

    @ApiModelProperty(value = "获取表单时间")
    private Date leadsFormTime;

    @ApiModelProperty("入学状态")
    private String studentStatus;

}
